04. TDD for APIs

Test-Driven Development (TDD) for APIs

FSND C2 L4 A06 TDD For APIs

Test-Driven Development (or TDD ) is a software development paradigm used very commonly in production. It is based on a short, rapid development cycle in which tests are written before the executable code and constantly iterated on.

  1. Write test for specific application behavior.
  2. Run the tests and watch them fail.
  3. Write code to execute the required behavior.
  4. Test the code and rewrite as necessary to pass the test
  5. Refactor your code.
  6. Repeat - write your next test.

Often while pair programming, one partner will write the test and the other will write the executable code, after which the partner will switch. This process is helpful for checking assumptions about behavior and making sure all expected behavior is captured.

QUIZ QUESTION: :

Match each step of Test-Driven Development with its order number.

ANSWER CHOICES:



Order Number

Step

Pass Test

Fail Test

Refactor

Write Code

Write Test

SOLUTION:

Order Number

Step

Pass Test

Fail Test

Refactor

Write Code

Write Test